package util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.faces.context.FacesContext;

public class Util {

	
	public static Object getManagedBean(String beanName) {
		return FacesContext.getCurrentInstance().getApplication().getELResolver().getValue(FacesContext.getCurrentInstance().getELContext(), null, beanName);
	}
	
	// metodo para validar email digitado pelo usuario

	public static boolean validaEmail(String emailEnt) {
		boolean verificado = false;
		System.out.print(" no validador ");
		Pattern email = Pattern.compile("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
		Matcher m = email.matcher(emailEnt);
		while (m.find()) 
			verificado = true;

		return verificado;

	}
	
}
